package casia.isiteam.springbootshiro.service;


import casia.isiteam.springbootshiro.model.po.test.Girl;
import casia.isiteam.springbootshiro.model.po.test.GirlRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Author wzy
 * Date 2017/7/26 14:05
 */
@Service
public class GirlService {
    @Autowired
    private GirlRepository girlRepository ;

    public void getAge(Integer id) throws Exception{
        Girl girl =  girlRepository.findOne(id);
        Integer age = girl.getAge();
        if(age<10){
            throw  new Exception("你还在上小学吧");
        }else if(10<=age && age <18){
            throw  new Exception("你可能还在上初中");
        }
    }

    public Girl findone(Integer id){
        return girlRepository.findOne(id);
    }
}
